package models;

import models.crudsiena.SienaSupport;
import siena.*;
import siena.embed.Embedded;
import siena.embed.EmbeddedMap;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Cyril
 * Date: 07.08.11
 * Time: 16:31
 * To change this template use File | Settings | File Templates.
 */
@Table("photos")
public class Photo extends SienaSupport {

    @Id(Generator.AUTO_INCREMENT)
    public Long id;

    @Column("title")
    @Max(150)
    public String title;

    @Column("description")
    @Text
    @Max(10000)
    public String content;

    @Embedded
    public Status status = Status.DRAFT;

    @Filter("photo")
    public Query<PicasaPhoto> picasaPhoto;

    @Embedded
    public List<String> thumb;

    @Override
    public String toString() {
        return title;
    }

    public static Query<Photo> all() {
        return Model.all(Photo.class);
    }

    public static enum Status { DRAFT, PUBLISHED }
}
